import { useState, useEffect } from 'react'
import { login } from '../src/api/user';
import { useSelector, useDispatch } from 'react-redux';
import { getHeadAction } from '../src/store/userstates/actions/index'

function App() {
  const list = useSelector( state => state.user.list )
  const dispatch = useDispatch()
  const action = getHeadAction()
  const params = {
    mobile: '13800000002',
    password: '123456'
  };

  const onLogin = async() => {
    await login(params)
    dispatch(action)

  }

  setTimeout(() => {
    console.log(list);
  }, 5000)




  return (
    <div className="App">
      <div>
        <button onClick={ onLogin }>登录</button>
        { }
        <div>{list.mobile }</div>
      </div>
    </div>
  )
}

export default App
